<?php
//循环删除目录和文件函数
function delDirAndFile( $dirName,$dirarray )
{
    if ( $handle = opendir( "$dirName" ) ) {
        while ( false !== ( $item = readdir( $handle ) ) ) {
            if ( $item != "." && $item != ".." ) {
                if ( is_dir( "$dirName/$item" ) ) {
                    delDirAndFile( "$dirName/$item" );
                } else {
                    if( unlink( "$dirName/$item" ) )
                        echo "成功删除文件：". $dirName/$item.PHP_EOL;
                }
            }
        }
        closedir( $handle );
        if(in_array($dirName, $dirarray) ){
        }else{
            if( rmdir( $dirName ) )
                echo "成功删除目录：".$dirName.PHP_EOL;
        }

    }
}

delDirAndFile("D:\\Xiaomi/",array("D:\\Xiaomi/"));

echo substr_replace("Hello world","earth",6,1);

?>
